<?php

	class Messages extends CI_Model
	{
		public function __construct()
		{
			parent::__construct();
		}

		function getMsg($id = false)
		{
			$query = $this->db->get_where('tghm_messages',array('id' => $id));
			return $query->row_array();
		}
		
		function getAllMsgs()
		{
			$this->db->order_by('order','asc');
			$query = $this->db->get('tghm_messages');			
			return $query->result_array();
		}		

		function addNewMsg($data)
		{
			return $this->db->insert('tghm_messages',$data);
		}		

		function deleteMsg($id)
		{
			return $this->db->delete('tghm_messages',array('id'=>$id));
		}
	}